home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / System / Ultra / Ultra.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-07  |  2.0 KB  |  55 lines  |  [TEXT/KAHL]

  1. /* Ultra.h -- This header file is an essential component of Ultra. */
  2.  
  3. /***** WARNING! *************** WARNING! *************** WARNING! ******
  4.  
  5.  You MUST call Ultra_Init() before using Ultra!  Also, you MUST read in
  6.  non-zero values for Ultra_seed1 and Ultra_seed2 BEFORE calling
  7.  Ultra_Init(). Ultra_Init() ends by calling Ultra_SaveStart(). */
  8.  
  9.  extern unsigned long Ultra_seed1,Ultra_seed2;
  10.  
  11.  extern void Ultra_Init();
  12.  
  13. /**********************************************************************/
  14.  
  15. /******* Function                            Return value *************/      
  16.  
  17. extern long Ultra_long32();            /* U[-2147483648,2147483647] */
  18. extern long Ultra_long31();            /* U[0,2147483647] */
  19.  
  20. extern int Ultra_int16();            /* U[-32768,32767] */
  21. extern int Ultra_int15();            /* U[0,32767] */
  22.  
  23. extern int Ultra_int8();            /* (int) U[-128,127] */
  24. extern int Ultra_int8u();            /* (int) U[0,255] */
  25. extern int Ultra_int7();            /* (int) U[0,127] */
  26.  
  27. extern int Ultra_int1();            /* (int) U[0,1] */
  28.  
  29. extern float Ultra_uni();            /* U(0,1) with ≥ 25-bit mantissa */
  30. extern float Ultra_vni();            /* U(-1,1) but excluding zero */
  31.  
  32. extern double Ultra_duni();            /* U[0,1) with ≤ 63-bit mantissa */
  33. extern double Ultra_dvni();            /* U(-1,1) with ≤ 63-bit mantissa */
  34.  
  35. extern float Ultra_norm(float mu,float sigma);    /* Normal(mean,std. dev.) */
  36. extern float Ultra_expo(float mu);                /* Exponential(mean > 0) */
  37.  
  38. /**********************************************************************/
  39.  
  40. /* The following functions and structure are provided in order to allow you
  41. to reproduce a sequence of random numbers, eg., for duplicating a Monte Carlo
  42. simulation exactly.  Ultra_Init() must be called BEFORE either of these two
  43. functions. */
  44.  
  45. extern void Ultra_SaveStart();
  46. extern void Ultra_RecallStart();
  47.  
  48. /* Ultra_Remember is really a non-long structure of 324 bytes.  It is shown
  49. here to facilitate saving to a file and restoring at a later date. */
  50.  
  51. extern unsigned long Ultra_Remember[81];
  52.  
  53. #define UltraSize (size_t)4
  54. #define UltraLength (size_t)81
  55.